/***

select  rownumber() over (ORDER BY YASAL/100 DESC ) as Row, a.YAAN8, DATE(CHAR(YADOB+1900000)), DATE(CHAR(YADSI+1900000)) as Org_Strt_Dte, YADOB, YAALPH, b.YAJBCX, YASAL/100, YASAL/833552522
from C0053prdd.F060116 as a, C0053PRDD.F0101, C0053prdd.F060120 as b
WHERE 
	a.YAAN8=ABAN8
AND	a.YAAN8=b.YAAN8

AND	ABAT1='E' 
Order By YASAL DESC


go

select top 100 RemarkExplaination, DatePayCheck, * from rd4_dwcr.dbo.JDEPYEmployeeTransactionHist
where 
RemarkExplaination not in ('Regular                       ', 
'Holiday                       ','PDO                           ','OT 1.5                        '
,'OT 2.0                        ')
and
AddressNumber=103558


***/
use RD_DWCR
go



select ROW_NUMBER() over (order by [RateSalaryAnnual] DESC) as [Row], 
	NTILE(100) over (order by [RateSalaryAnnual] DESC) as [ Rank],
	b.AlphaName, a.BUSINESSUNITCODE, a.JobType,
	RateSalaryAnnual, a.category01payroll,
	CONVERT (date,DateBirth) as [DOB], 
	CONVERT (date,[DateOriginalEmployment]) as [Started date], 
	CONVERT(date, [DateLastRaise]) as [Date Last Raise], 
	RatePreviousSalary
FROM 
	JDEPYEmployeeMasterInfo a, JDEABAddressBookMaster b 
where
	b.[AddressNumber]=a.AddressNumber and 
	b.SearchTypeCode='E' and a.BUSINESSUNITCODE='         782'
order by RateSalaryAnnual DESC
--FOR XML AUTO, ROOT('Salary');



use RD4_DWCR
go



select ROW_NUMBER() over (order by [RateSalaryAnnual] DESC) as [Row], 
	NTILE(100) over (order by [RateSalaryAnnual] DESC) as [ Rank],
	b.AlphaName, a.BUSINESSUNITCODE, a.JobType,
	RateSalaryAnnual, a.category01payroll,
	CONVERT (date,DateBirth) as [DOB], 
	CONVERT (date,[DateOriginalEmployment]) as [Started date], 
	CONVERT(date, [DateLastRaise]) as [Date Last Raise], 
	RatePreviousSalary
FROM 
	JDEPYEmployeeMasterInfo a, JDEABAddressBookMaster b 
where
	b.[AddressNumber]=a.AddressNumber and 
	b.SearchTypeCode='E' 
	--and a.BusinessUnitCode='         782'
order by RateSalaryAnnual DESC
--FOR XML AUTO, ROOT('Salary')